#include "eqgainspinbox.h"
#include "dm/dmdef.h"

EqGainSpinBox::EqGainSpinBox(QWidget *parent)
    : QSpinBox{parent}
{
    setRange(EQ_GAIN_MIN / EQ_GAIN_STEP, EQ_GAIN_MAX / EQ_GAIN_STEP);
}

double EqGainSpinBox::value() const
{
    return QSpinBox::value() * EQ_GAIN_STEP;
}

QString EqGainSpinBox::textFromValue(int value) const
{
    return QString::number(value * EQ_GAIN_STEP);
}

int EqGainSpinBox::valueFromText(const QString &text) const
{
    return text.toDouble() / EQ_GAIN_STEP;
}
